package com.game.data
{
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	
	public class GameObject extends EventDispatcher
	{
		public var id : int;
		public var name : String;
		
		public function GameObject(target:IEventDispatcher=null)
		{
			super(target);
		}
		
		public function readProperty(property : String , value : *):void
		{
			if(property == "")
				return;
			if(this.hasOwnProperty(property))
			{
				if(this[property] is int)
				{
					this[property] = int(value);
				}
				else if(this[property] is Number)
				{
					this[property] = Number(value);
				}
				else if(this[property] is Boolean)
				{
					this[property] = Boolean(int(value));
				}
				else if(this[property] is Vector.<int>)
				{
					(this[property] as Vector.<int>).push(int(value));
				}
				else if(this[property] is Vector.<String>)
				{
					(this[property] as Vector.<String>).push(String(value));
				}
				else if(this[property] is Array)
				{
					(this[property] as Array).push(String(value));
				}
				else
				{
					this[property] = String(value);
				}
			}
		}
	}
}